<!-- 测试页 -->
<template>
  <div>
    <h1>测试页</h1>
    <ImageUpload />
  </div>
</template>

<script>
import { getUserInfo } from '@/api/user'
export default {

  data() {
    // 二次验证密码校验函数
    const checkPass = (rule, values, callback) => {
      if (values === this.ruleForm.password) {
        callback()
      } else {
        callback(new Error('两次输入的密码不一致'))
      }
    }
    return {
      ruleForm: {
        mobile: '',
        password: '',
        password2: ''
      },
      rules: {
        mobile: [{ required: true, message: '此项不能为空', trigger: 'blur' }],
        password: [{ required: true, message: '此项不能为空', trigger: 'blur' }],
        password2: [{ required: true, message: '此项不能为空', trigger: 'blur' },
          { trigger: 'blur', validator: checkPass }]
      }
    }
  },
  methods: {
    async onClick() {
      const result = await getUserInfo()
      console.log(result)
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
